import { getLoginTime } from '@/utils/storage'

const state = {
  loginTime: getLoginTime()
}

const mutations = {
  setLoginTime(state, time) {
    console.log('mutation:', time)
    state.loginTime = time
  }
}

const actions = {
  setLoginTime({ commit }, time) {
    console.log('action:', time)
    // let commit = store.commit
    // let { commit } = store
    commit('setLoginTime', time)
  }
}

// dispatch('user/login')
// dispatch('login/setLoginTime', new Date())

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
